/*
 * @Date         : 2024-05-20 11:18:17 星期1
 * @Author       : xut
 * @Description  :
 */
import { Router } from "express"
import { zodSchemaValidate as validate } from "../middleware/zodSchemaValidate.middleware"
import { adminRoleValidate } from "../middleware/adminRoleValidate.middleware"
import * as user from "../controller/user.controller"
import {
  getUserPageSchema,
  getUserSchema,
  updateUserSchema,
  deleteUserSchema,
} from "../schema/user.schema"

export const router = Router()

router.get("/page", validate(getUserPageSchema), user.getUsersPage)
router.get("/:id", validate(getUserSchema), user.getUser)
router.patch(
  "/:id",
  adminRoleValidate,
  validate(updateUserSchema),
  user.updateUser
)
router.delete(
  "/:id",
  adminRoleValidate,
  validate(deleteUserSchema),
  user.deleteUser
)
